/**
 * Created with Intellij JDEA
 * Description:
 * User:
 * Date:2022-05-09
 * Time:14:59
 */
public class 增减字符串匹配 {
    class Solution {
        public int[] diStringMatch(String s) {
            int[] arr = new int[s.length()+1];
            int numI = 0;
            int numD = s.length();
            for(int i = 0;i < s.length();++i) {
                arr[i] = s.charAt(i) == 'I' ? numI++ : numD--;
            }
            arr[s.length()] = numI;
            return arr;
        }
    }
}
